<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script th:src="@{/js/jquery.min.js}"></script>
    <style>
        table {
            border-color: #000000;
            border-collapse: collapse; /*设置单元格的边框合并为1*/
            width: 50%;
            text-align: center;
        }

        td {
            border-color: #000000;
        }

        th {
            background: #F4F4F4;
        }

        table tr:nth-child(odd) {
            background: #FFFFFF;
        }

        table tr:nth-child(even) {
            background: #F4F4F4;
        }
        a{
            margin-top: 10px;
        }
    </style>
</head>
<body>
<h2 style="display: inline">欢迎，</h2>
<h1 th:style="'display:' + (${session.student == null} ? 'none' : 'inline-block') + ''" th:text="${session.student != null} ? ${session.student.stuName}:''" style="display: inline"></h1>
<h1 th:style="'display:' + (${session.teacher == null} ? 'none' : 'inline-block') + ''" th:text="${session.teacher != null} ? ${session.teacher.name}:''" style="display: inline"></h1>
<h1 th:style="'display:' + (${session.teacher == null && session.student == null} ? 'inline-block' : 'none') + ''" style="display: inline">管理员</h1>
<br>
<hr>
<a th:style="'display:' + (${session.manager == null} ? 'none' : 'inline-block') + ''" href="/student/list">学生信息管理</a><br>
<a th:style="'display:' + (${session.manager == null} ? 'none' : 'inline-block') + ''" href="/teacher/list">老师信息管理</a><br>
<a th:style="'display:' + (${session.manager == null} ? 'none' : 'inline-block') + ''" href="/classz/list">班级信息管理</a><br>
<a th:style="'display:' + (${session.manager == null} ? 'none' : 'inline-block') + ''" href="/course/list">课程信息管理</a><br>


<div th:style="'width: 70%;display:' + (${session.student == null} ? 'none' : 'inline-block') + ''">
    <h2>我的课程</h2>
    <table border="1">
        <thead>
        <th>编号</th>
        <th>课程</th>
        <th>上课时间</th>
        <th>班级</th>
        <th>任课老师</th>
        <th>分数</th>
        </thead>
        <tbody>
        <tr th:each="subject:${session.selectedCourse}">
            <td th:text="subject != null ? ${subject.id}:''"></td>
            <td th:text="subject != null ? ${subject.name}:''"></td>
            <td th:text="subject != null ? ${subject.startTime}:''"></td>
            <td th:text="subject != null ? ${subject.classzName}:''"></td>
            <td th:text="subject != null ?${subject.teacherName}:''"></td>
            <td th:text="subject != null ? ${subject.score}:''"></td>
        </tr>
        </tbody>
    </table>
    <br>
    <br>
    <a th:href="'/course/selectPage?studentId='+ @{${session.student== null } ? '' : ${session.student.id}}">点击进行选课</a>
</div>

<div th:style="'width: 80%;display:' + (${session.teacher == null} ? 'none' : 'inline-block') + ''">
    <h2>我的课表</h2>
    <table border="1">
        <thead>
            <th>编号</th>
            <th>课程</th>
            <th>上课时间</th>
            <th>班级</th>
            <th>任课老师</th>
            <th>操作</th>
        </thead>
        <tbody>
            <tr th:each="subject:${session.teacherCourse}">
                <td th:text="subject != null ? ${subject.id}:''"></td>
                <td th:text="subject != null ? ${subject.name}:''"></td>
                <td th:text="subject != null ? ${subject.startTime}:''"></td>
                <td th:text="subject != null ? ${subject.classzName}:''"></td>
                <td th:text="subject != null ?${subject.teacherName}:''"></td>
                <td><a th:href="'/course/teacherCourseInfo?courseId='+@{subject != null ? ${subject.id}:''}">进入课程</a></td>
            </tr>
        </tbody>
    </table>
    <br>
    <br>
</div>
</body>
</html>